﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Windstamp.Utility.BookDownload.Core;

namespace Windstamp.Utility.BookDownload.ConsoleTest {
    class Program {
        static void Main(string[] args) {
            try {
                string url = @"http://www.zirankxzl.cn/n/drspath_0278635955d8ea0181ca88343c9f6d401f9756e0e9f1a687f50dbb115c5ac0338aeaa654234cb7d8b7999e2766e962a789c855378f8ce2dfa8916aaa0e76cea9a35c70b07c72e9fceb958a7c602095545f3fdc16d8f7e423c5b293a2cb5f5c51a3bbd304add4cdb0de8fd1186cf0de7c0b1674531e4ee3823a5fa504131b4e8719237ccd62bc156e6d140cb0082fffba5d6d953dd609cf5de32962fb3dc97cee.shtml?firstdrs=http%3A%2F%2Fbook.ucdrs.superlib.net%2FbookDetail.jsp%3FdxNumber%3D000011724411%26d%3D576B30CC65BDEFD6303F453BB85AEE8C";
                DownloadEntrance bpi = new DownloadEntrance();
                bpi.AnalyzePage(url);
                bpi.StartDownloadMain();
            } catch(Exception ex) {
                if(ex.Message == "antispiderShowVerify") {
                    Console.WriteLine("需要输入验证码，在正式的版本中需要做处理，以弹出一个窗口来输入验证码，然后继续下载，而不需要退出");
                } else if(ex.Message ==  "notGetUrl") {
                    Console.WriteLine("未获取到重定向 Url");
                } else {
                    Console.WriteLine(string.Format("异常：{0}", ex.Message));
                }
            } finally {
                Console.ReadLine();
            }
        }
    }
}
